import { LabelValue } from "@arco-design/web-vue/es/tree-select/interface";
import { getDict } from "../service/dict/data/dict.data";

export const formatOptions = ref<LabelValue[]>();
export const prefixOptions = ref<LabelValue[]>();

export const getFormatOptions = async () => {
  const data = await getDict("format");
  formatOptions.value = data.data;
};

export const getPrefixOptions = async () => {
  const data = await getDict("prefix");
  prefixOptions.value = data.data;
};

export const fetchDictOptionsByName = async (name: string) => {
  const options = ref();
  const { data } = await getDict(name);
  options.value = data;

  return options.value;
};
